<? /* license

BilugCMS (http://www.bilug.it) - Content Management System for dynamic web sites
Copyright (C) 2005-2008  Federico Villa and Alessio Loro Piana

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

For reference, contact bilugcms@vilnet.it


license */ ?>
<?
$argo = $pag = $_GET["argo"];
$ind = $_GET["ind"];

//funzione navigatore
function Nav($argo,$max,$pos,$pag)
{
	if ($max!=0) echo "Notizie: ".($pos+1)." di $max ";
	if ($pos>0) 
	{
		echo "<a href=\"index.php?pag=argo.php&argo=$argo&ind=0\">(&laquo;)Prime</a> ";
		echo "<a href=\"index.php?pag=argo.php&argo=$argo&ind=".($pos-$pag)."\">(&lt;)Precedenti</a> ";
	}
	if ($max>$pos+$pag) 
	{
		echo " <a href=\"index.php?pag=argo.php&argo=$argo&ind=".($pos+$pag)."\">Successivi(&gt;)</a>";
		echo " <a href=\"index.php?pag=argo.php&argo=$argo&ind=".($max-$pag)."\">Ultime(&raquo;)</a>";
	}
}

$str2="SELECT argomenti FROM argomenti WHERE ID=$argo";
$risultato2=mysql_query($str2);
$control2=mysql_fetch_row($risultato2);
// query per sapere l'argomento
$page = _MAX_ARG;
$str="SELECT count(*) FROM notizie WHERE argomento=$argo and autorizza='si'";
$risultato=mysql_query($str);
$max=mysql_fetch_row($risultato);
if (isset($ind)) $index=$ind;
if ($index<0 or !isset($index)) $index=0;
Nav($argo,$max[0],$index,$page);
$str="SELECT * FROM notizie WHERE argomento=$argo and autorizza='si' ORDER BY data DESC limit $index,$page";
$risultato=mysql_query($str);
echo "<h3>ARGOMENTO: $control2[0]</h3>
<ul class=\"argo\">";
while ($control=mysql_fetch_row($risultato))
// tiriamo fuori tutti i record dell'argomento
    {
       echo "<li><div class=\"elenco\">
       <a href=\"index.php?pag=news.php&news=$control[0]\">$control[1]</a></div>".
       "<div class=\"elencoimg\"><a href=\"index.php?pag=news.php&news=$control[0]\">".
       "<img width=\"30\" height=\"30\" alt=\"\"  src=\"../img/water.png\"></a></div><div class=\"azzerafloat\"></div></li>";
    }

?>
</ul>
<?Nav($argo,$max[0],$index,$page);?>
